import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xvideos/hj_utils/api_service/mine_service.dart';
import 'package:xvideos/hj_utils/global.dart';
import 'package:xvideos/tools_base/global_store/store.dart';

class InviteBindLogic extends GetxController {
  late final codeCtr = TextEditingController();

  void sure() async {
    if (codeCtr.text.length == 0) {
      showToast('请输入邀请码～');
      return;
    }
    final res = await MineService.postExchangeInviteCode(codeCtr.text);
    if (res) {
      showToast('绑定成功');
      globalStore.updateUserInfo();
      Get.back();
    } else {
      showToast('绑定失败');
    }
  }
}
